package main

import (
	"fmt"
	"time"
)

func main() {

	//ifest()
	//switchtest(5)
	//fortest()
	//gototest()
	//gototest1()
	continuetest()
}

func continuetest() {

loop:
	for i := 1; i <= 3; i++ {
		for j := 1; j <= 3; j++ {
			fmt.Print(i)
			fmt.Print("-")
			fmt.Println(j)
			continue loop
		}
	}
}

func gototest() {

	fmt.Println()
	//将会直接跳转到one代码块，然后继续向下执行
	goto One
	fmt.Println("zhixingzhong。。。")
One:
	fmt.Println("代码块1...")
}

//此种写法将会进行无线循环
func gototest1() {
	fmt.Println("zhixingzhong。。。")
One:
	time.Sleep(1 * time.Second)
	fmt.Println("代码块1...")
	//将会直接跳转到one代码块,然后继续往下执行
	goto One
}

func fortest() {
	for i := 1; i < 10; i++ {
		fmt.Print("hello \n")
		time.Sleep(1 * time.Second)
	}
	/*for i:=1;true ;i++  {
		fmt.Print("hello \n")
		time.Sleep(1*time.Second)
	}*/
	a := []string{"香蕉", "苹果", "雪梨"}
	for key, value := range a {
		fmt.Print(key)
		fmt.Print(value)
	}
	for _, value := range a {
		fmt.Print(value)
	}

}

func switchtest(a int) {
	switch a {
	case 1:
		fmt.Println("1")
	case 2:
		fmt.Println(2)
	default:
		fmt.Println("xxxxxxxxxx")
	}

	var b interface{}
	b = 32.0
	switch b.(type) {
	case int:
		fmt.Print("int")
	case string:
		fmt.Println("string")
	default:
		fmt.Print("other ...")
	}

}

func ifest() {
	a := 1
	if a > 0 {
		fmt.Println("a大于0")
	} else {
		fmt.Println("a<=0")
	}

}
